#pragma once
//
//    FILE: StudentTable.h
//  AUTHOR: Rob Tillaart
// VERSION: 0.1.1
// PURPOSE: Arduino library for Student or T-distribution math.
//    DATE: 2024-07-22

//  lookup table, do not change (unless you know what you do).
//
//  spreadsheet = ROUND(1000 * T.INV.2T(C$4;$B7))
//
//  x = degrees of freedom
//  y = confidence level 0.1, 0.05, 0.025, 0.01, 0.005 (single ended)
//  values are multiplied by 1000, to save RAM.
//


//  command line overrule possible
#ifndef STUDENT_MAX_SIZE
#define STUDENT_MAX_SIZE          (20)
#endif


//  uses 200 bytes of RAM
uint16_t StudentLUT[STUDENT_MAX_SIZE][5]
{
  // 80%   90%    95%    98%    99%
  //---------------------------------
  { 3078, 6314, 12706, 31821, 63657},  //  n = 1
  { 1886, 2920,  4303,  6965,  9925},
  { 1638, 2353,  3182,  4541,  5841},
  { 1533, 2132,  2776,  3747,  4604},
  { 1476, 2015,  2571,  3365,  4032},

  { 1440, 1943,  2447,  3143,  3707},
  { 1415, 1895,  2365,  2998,  3499},
  { 1397, 1860,  2306,  2896,  3355},
  { 1383, 1833,  2262,  2821,  3250},
  { 1372, 1812,  2228,  2764,  3169},

  { 1363, 1796,  2201,  2718,  3106},
  { 1356, 1782,  2179,  2681,  3055},
  { 1350, 1771,  2160,  2650,  3012},
  { 1345, 1761,  2145,  2624,  2977},
  { 1341, 1753,  2131,  2602,  2947},

  { 1337, 1746,  2120,  2583,  2921},
  { 1333, 1740,  2110,  2567,  2898},
  { 1330, 1734,  2101,  2552,  2878},
  { 1328, 1729,  2093,  2539,  2861},
  { 1325, 1725,  2086,  2528,  2845}   //  n = 20
};


/*
  { 1323, 1721, 2080, 2518, 2831},   //  n = 21
  { 1321, 1717, 2074, 2508, 2819},
  { 1319, 1714, 2069, 2500, 2807},
  { 1318, 1711, 2064, 2492, 2797},
  { 1316, 1708, 2060, 2485, 2787},

  { 1315, 1706, 2056, 2479, 2779},
  { 1314, 1703, 2052, 2473, 2771},
  { 1313, 1701, 2048, 2467, 2763},
  { 1311, 1699, 2045, 2462, 2756},
  { 1310, 1697, 2042, 2457, 2750},   //  n = 30

  { 1309, 1696, 2040, 2453, 2744},
  { 1309, 1694, 2037, 2449, 2738},
  { 1308, 1692, 2035, 2445, 2733},
  { 1307, 1691, 2032, 2441, 2728},
  { 1306, 1690, 2030, 2438, 2724},

  { 1306, 1688, 2028, 2434, 2719},
  { 1305, 1687, 2026, 2431, 2715},
  { 1304, 1686, 2024, 2429, 2712},
  { 1304, 1685, 2023, 2426, 2708},
  { 1303, 1684, 2021, 2423, 2704},  //  n = 40

  { 1303, 1683, 2020, 2421, 2701},
  { 1302, 1682, 2018, 2418, 2698},
  { 1302, 1681, 2017, 2416, 2695},
  { 1301, 1680, 2015, 2414, 2692},
  { 1301, 1679, 2014, 2412, 2690},

  { 1300, 1679, 2013, 2410, 2687},
  { 1300, 1678, 2012, 2408, 2685},
  { 1299, 1677, 2011, 2407, 2682},
  { 1299, 1677, 2010, 2405, 2680},
  { 1299, 1676, 2009, 2403, 2678},  //  n = 50

  { 1298, 1675, 2008, 2402, 2676},
  { 1298, 1675, 2007, 2400, 2674},
  { 1298, 1674, 2006, 2399, 2672},
  { 1297, 1674, 2005, 2397, 2670},
  { 1297, 1673, 2004, 2396, 2668},

  { 1297, 1673, 2003, 2395, 2667},
  { 1297, 1672, 2002, 2394, 2665},
  { 1296, 1672, 2002, 2392, 2663},
  { 1296, 1671, 2001, 2391, 2662},
  { 1296, 1671, 2000, 2390, 2660},  //  n = 60

  { 1296, 1670, 2000, 2389, 2659},
  { 1295, 1670, 1999, 2388, 2657},
  { 1295, 1669, 1998, 2387, 2656},
  { 1295, 1669, 1998, 2386, 2655},
  { 1295, 1669, 1997, 2385, 2654},

  { 1295, 1668, 1997, 2384, 2652},
  { 1294, 1668, 1996, 2383, 2651},
  { 1294, 1668, 1995, 2382, 2650},
  { 1294, 1667, 1995, 2382, 2649},
  { 1294, 1667, 1994, 2381, 2648},  //  n = 70

  { 1294, 1667, 1994, 2380, 2647},
  { 1293, 1666, 1993, 2379, 2646},
  { 1293, 1666, 1993, 2379, 2645},
  { 1293, 1666, 1993, 2378, 2644},
  { 1293, 1665, 1992, 2377, 2643},

  { 1293, 1665, 1992, 2376, 2642},
  { 1293, 1665, 1991, 2376, 2641},
  { 1292, 1665, 1991, 2375, 2640},
  { 1292, 1664, 1990, 2374, 2640},
  { 1292, 1664, 1990, 2374, 2639},  // n = 80

  { 1292, 1664, 1990, 2373, 2638},
  { 1292, 1664, 1989, 2373, 2637},
  { 1292, 1663, 1989, 2372, 2636},
  { 1292, 1663, 1989, 2372, 2636},
  { 1292, 1663, 1988, 2371, 2635},

  { 1291, 1663, 1988, 2370, 2634},
  { 1291, 1663, 1988, 2370, 2634},
  { 1291, 1662, 1987, 2369, 2633},
  { 1291, 1662, 1987, 2369, 2632},
  { 1291, 1662, 1987, 2368, 2632},  //  n = 90

  { 1291, 1662, 1986, 2368, 2631},
  { 1291, 1662, 1986, 2368, 2630},
  { 1291, 1661, 1986, 2367, 2630},
  { 1291, 1661, 1986, 2367, 2629},
  { 1291, 1661, 1985, 2366, 2629},

  { 1290, 1661, 1985, 2366, 2628},
  { 1290, 1661, 1985, 2365, 2627},
  { 1290, 1661, 1984, 2365, 2627},
  { 1290, 1660, 1984, 2365, 2626},
  { 1290, 1660, 1984, 2364, 2626}  //  n = 100

120	1289	1658	1980	2358	2617
10000	1282	1645	1960	2327	2576  //  effectively infinity.
*/


//  -- END OF FILE --

